package cn.com.zero.front.auth.po;

import cn.com.zero.base.po.BasePO;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.util.StringUtils;

import java.util.Date;

/**
 * @author liuxh
 * @version 1.0.0
 * @Description 登录用户详细信息
 * @createTime 2023/4/3 15:11
 */
@ApiModel(value = "AuthUserInfoPO", description = "登录用户详细信息")
public class AuthUserInfoPO extends BasePO {
    private static final long serialVersionUID = 8361492248226525351L;

    /**
     * 用户ID
     */
    @ApiModelProperty("用户ID")
    private String userId;

    /**
     * 用户名
     */
    @ApiModelProperty("用户名")
    private String userName;

    /**
     * 手机号
     */
    @ApiModelProperty("手机号")
    private String mobile;

    /**
     * 展示用手机号
     */
    @ApiModelProperty("展示用手机号")
    private String showMobile;

    /**
     * 头像
     */
    @ApiModelProperty("头像")
    private String avatar;

    /**
     * 密码密文
     */
    @JsonIgnore
    private String password;

    /**
     * 用户是否未过期: true 未过期; false 已过期
     */
    @ApiModelProperty("用户是否未过期: true 未过期; false 已过期")
    private Boolean accountNonExpired;

    /**
     * 用户是否可用状态: true 可用; false 不可用
     */
    @ApiModelProperty("用户是否可用状态: true 可用; false 不可用")
    private Boolean enabled;

    /**
     * 最近一次登录时间
     */
    @ApiModelProperty("最近一次登录时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastLoginTime;

    /**
     * 最近一次登录IP
     */
    @ApiModelProperty("最近一次登录IP")
    private String lastLoginIp;

    /**
     * 最近一次登录终端
     */
    @ApiModelProperty("最近一次登录终端")
    private String lastLoginDevice;

    /**
     * 注册时间
     */
    @ApiModelProperty("注册时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;


    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getShowMobile() {
        return showMobile;
    }

    public void setShowMobile(String showMobile) {
        this.showMobile = showMobile;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }


    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Boolean getAccountNonExpired() {
        return accountNonExpired;
    }

    public void setAccountNonExpired(Boolean accountNonExpired) {
        this.accountNonExpired = accountNonExpired;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public Date getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public String getLastLoginIp() {
        return lastLoginIp;
    }

    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp;
    }

    public String getLastLoginDevice() {
        return lastLoginDevice;
    }

    public void setLastLoginDevice(String lastLoginDevice) {
        this.lastLoginDevice = lastLoginDevice;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * 是否设置了用户密码 true:已设置 false：未设置
     */
    @ApiModelProperty("是否设置了用户密码 true:已设置 false：未设置")
    public boolean getIsPasswordSet() {
        return StringUtils.hasLength(this.password);
    }
}
